import { Login } from "@/api/interface/index";
import authMenuList from "@/assets/json/authMenuList.json";
import http from "@/api";
import qs from "qs";

/**
 * @name 登录模块
 */
// 用户登录
export const loginApi = (params: Login.ReqLoginForm) => {
  return http.post<Login.ResLogin>(`login/login`, qs.stringify(params));
};

// 获取菜单列表
export const getAuthMenuListApi = () => {
  return authMenuList;
};

// 用户退出登录
export const logoutApi = () => {
  return http.post(`login/logout`);
};

//修改自己的登录密码
export const updatePwdApi = (params: { pwd: string; oldPwd: string }) => {
  return http.post(`login/updatePwd`, qs.stringify(params));
};
